(function () {
  function windowSize() {
    let baseFontSize = 10;
    let baseWidth = 375;
    let clientWidth = document.documentElement.clientWidth || window.innerWidth;
    let rem = 100;
    rem = Math.floor((clientWidth / baseWidth) * baseFontSize);

    document.querySelector("html").style.fontSize = rem + "px";
  }
  windowSize();
  window.onresize = windowSize;

  $(".my").on("click", function () {
    $(".my-popup").css("display", "block");
  });

  $(".my-mask").on("click", function () {
    $(".my-popup").css("display", "none");
  });

  $(".index").on("click", function () {
    window.location.href = "./index.html";
  });

  $(".service").on("click", function () {
    window.location.href = "./service.html";
  });

  $(".history").on("click", function () {
    window.location.href = "./history.html";
  });
  $(".presented").on("click", function () {
    window.location.href = "./credits.html";
  });

  const faq = document.getElementsByClassName("faq-list-item");
  if (faq?.length > 0) {
    for (let i = 0; i < faq.length; i++) {
      faq[i].onclick = (e) => {
        const p = faq[i].children[1];
        const arrow = faq[i].children[0].children[1];
        const title = faq[i].children[0].children[0];
        if (p.classList.contains("hidden")) {
          p.classList.remove("hidden");
          arrow.classList.add("arrow-up");
          arrow.classList.remove("arrow-down");
          title.classList.add("title-bule");
        } else {
          p.classList.add("hidden");
          arrow.classList.add("arrow-down");
          arrow.classList.remove("arrow-up");
          title.classList.remove("title-bule");
        }
      };
    }
  }
})();
